package com.okRPC.apis;

import com.okRPC.client.annotation.RpcAutowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

/**
 * Description: This is a sample class.
 * Author: Simon
 * Date: 2023/10/10
 */

@Controller
public class OKController {

    @RpcAutowired(version = "1.0")
    OkService okService;

    @GetMapping("/okService")
    public ResponseEntity<String> getOkService(){
        String str = okService.sayOk();
        return  ResponseEntity.ok(str);
    }

    @GetMapping("/hello/world")
    public ResponseEntity<String> pullServiceInfo(@RequestParam("name") String name){
        return  ResponseEntity.ok(okService.sayHello(name));
    }

    @GetMapping("/test")
    public ResponseEntity<String> getTest(){
        return  ResponseEntity.ok("this is test");
    }
}
